<template>
  <div class="GBehaviorRank">
    <zyInfoPanel title="高危行为异常行为排名查询" :showUnfoldButton="false" class="InfoItem">
      <div class="filter-box">
        <div class="filter-item">
          <div class="filter-item-name">收/寄件时间</div>
          <div class="filter-item-cont">
            <datePicker v-model="time"></datePicker>
          </div>
        </div>
        <zy-button @click="getData" class="filterBtn" type="primary">查询</zy-button>
      </div>
    </zyInfoPanel>

    <div class="table-panel" :loading="loading">
      <zyInfoPanel title="物流企业收/寄件排名" :showUnfoldButton="false" class="tableItem">
        <el-table :data="enterpriseData" class="tableBox">
          <el-table-column type="index" label="序号"></el-table-column>
          <el-table-column prop="company_name" label="企业名称"></el-table-column>
          <el-table-column prop="legal_person" label="法人姓名"></el-table-column>
          <el-table-column prop="legal_phone" label="法人联系方式"></el-table-column>
          <el-table-column prop="logist_num" label="收/寄件总数"></el-table-column>
        </el-table>
      </zyInfoPanel>
      <zyInfoPanel title="合作站点收/寄件排名" :showUnfoldButton="false" class="tableItem">
        <el-table :data="siteData" class="tableBox">
          <el-table-column type="index" label="序号"></el-table-column>
          <el-table-column prop="company_name" label="合作站点名称"></el-table-column>
          <el-table-column prop="legal_person" label="法人姓名"></el-table-column>
          <el-table-column prop="legal_phone" label="法人联系方式"></el-table-column>
          <el-table-column prop="logist_num" label="收/寄件总数"></el-table-column>
        </el-table>
      </zyInfoPanel>
      <zyInfoPanel title="揽件员揽件排名" :showUnfoldButton="false" class="tableItem">
        <el-table :data="solicitorData" class="tableBox">
          <el-table-column type="index" label="序号"></el-table-column>
          <el-table-column prop="employee_name" label="揽件员姓名"></el-table-column>
          <el-table-column prop="employee_mobile" label="联系电话"></el-table-column>
          <el-table-column prop="logist_num" label="揽件数"></el-table-column>
        </el-table>
      </zyInfoPanel>
      <zyInfoPanel title="辖区收/寄件排名" :showUnfoldButton="false" class="tableItem">
        <el-table :data="jurisdictionData" class="tableBox">
          <el-table-column type="index" label="序号"></el-table-column>
          <el-table-column prop="regulated_name" label="辖区"></el-table-column>
          <el-table-column prop="logist_num" label="收/寄件总数"></el-table-column>
        </el-table>
      </zyInfoPanel>
    </div>

  </div>
</template>

<script>
	import datePicker from "../../../../components/datePicker/index"

	export default {
		name: "GBehaviorRank",
		props: {},
		data() {
			// 收/寄件时间
			return {
				loading: false,
				time: [],
				enterpriseData: [],
				siteData: [],
				solicitorData: [],
				jurisdictionData: [],
				pagination: {
					page_start: 1,
					page_size: 9999
				}
			};
		},
		computed: {},
		watch: {},
		components: {datePicker},
		methods: {
			getEnterpriseData() {
				this.enterpriseData = [];
				let data = {field: 'judge_action_id', pagination: this.pagination};
				data.start_created_time = this.time[0] / 1000;
				data.end_created_time = this.time[1] / 1000;
				this.$axios.post(this.$api.g_getCompanyRiskReport, data).then(res => {
					let {code, msg, data} = res;
					if (code == 200) {
						this.enterpriseData = data.list.filter(item => {
							return item;
						});
					} else {
						this.enterpriseData = [];
					}
				}).catch(ret => {
					this.$message.error(ret.msg || '服务繁忙，请稍后再试');
				});
			},
			getSiteData() {
				this.siteData = [];
				let data = {field: 'judge_action_id', pagination: this.pagination};
				data.start_created_time = this.time[0] / 1000;
				data.end_created_time = this.time[1] / 1000;
				this.$axios.post(this.$api.g_getCooperRiskReport, data).then(res => {
					let {code, msg, data} = res;
					if (code == 200) {
						this.siteData = data.list.filter(item => {
							return item;
						});
					} else {
						this.siteData = [];
					}
				}).catch(ret => {
					this.$message.error(ret.msg || '服务繁忙，请稍后再试');
				});
			},
			getSolicitorData() {
				this.solicitorData = [];
				let data = {field: 'judge_action_id', pagination: this.pagination};
				data.start_created_time = this.time[0] / 1000;
				data.end_created_time = this.time[1] / 1000;
				this.$axios.post(this.$api.g_getEmployeeRiskReport, data).then(res => {
					let {code, msg, data} = res;
					if (code == 200) {
						this.solicitorData = data.list.filter(item => {
							return item;
						});
					} else {
						this.solicitorData = []
					}
				}).catch(ret => {
					this.$message.error(ret.msg || '服务繁忙，请稍后再试');
				});
			},
			getRegulatedData() {
				this.jurisdictionData = [];
				let data = {field: 'judge_action_id', pagination: this.pagination};
				data.start_created_time = this.time[0] / 1000;
				data.end_created_time = this.time[1] / 1000;
				this.$axios.post(this.$api.g_getRegulatedRiskReport, data).then(res => {
					let {code, msg, data} = res;
					this.loading = false;
					if (code == 200) {
						this.tableData = data.list.filter(item => {
							return item;
						});
					} else {
						this.tableData = []
					}
				}).catch(ret => {
					this.$message.error(ret.msg || '服务繁忙，请稍后再试');
				});
			},
			getData() {
				this.loading = false;
				this.getEnterpriseData();
				this.getSiteData();
				this.getSolicitorData();
				this.getRegulatedData();
				this.loading = true;
			}
		},
		mounted() {
			this.getData();
		},
		created() {
		}
	}
</script>

<style scoped lang="less" src="@/style/government/abDataStatistics/behaviorRank/index.less">

</style>
